<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>遍历学习</title>
</head>
<body>
<div id="app">
    <h1>简单的列表渲染</h1>
    <ul>
        <li v-for="i in 3">{{i}}</li>
    </ul>
    <h1>简单的列表渲染-带索引</h1>
    <ul>
        <li v-for="(i,index) in 3">index: {{index}} -- {{i}}</li>
    </ul>
    <table width="300px" border="1px">
        <tr v-for="(p, index) in person">
            <td>{{index}}</td>
            <td>{{p.name}}</td>
            <td>{{p.age}}</td>
            <td>{{p.sex}}</td>
        </tr>
    </table>
</div>
<script src="vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {
            person: [
                {name: "jack", age: 18, sex: "male"},
                {name: "mary", age: 15, sex: "female"},
                {name: "tom", age: 20, sex: "male"}
            ]
        }
    })
</script>
</body>
</html>